/*    */ package com.wzh.action.login;
/*    */ 
/*    */ import com.opensymphony.xwork2.ActionContext;
/*    */ import com.opensymphony.xwork2.ActionSupport;
/*    */ import com.wzh.bean.user.UserInfo;
/*    */ import com.wzh.service.user.UserService;
/*    */ import java.util.Map;
/*    */ import javax.annotation.Resource;
/*    */ import org.springframework.stereotype.Controller;
/*    */ 
/*    */ @Controller
/*    */ public class LoginAction extends ActionSupport
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */ 
/*    */   @Resource
/*    */   private UserService userService;
/*    */   private UserInfo user;
/*    */ 
/*    */   public UserInfo getUser()
/*    */   {
/* 24 */     return this.user;
/*    */   }
/*    */ 
/*    */   public void setUser(UserInfo user) {
/* 28 */     this.user = user;
/*    */   }
/*    */ 
/*    */   public String index() {
/* 32 */     return "index";
/*    */   }
/*    */ 
/*    */   public String login() {
/* 36 */     this.user = this.userService.find(this.user.getUsername(), this.user.getPassword());
/*    */ 
/* 38 */     if (this.user != null) {
/* 39 */       ActionContext.getContext().put("message", "登陆成功,点击确定进入后台管理");
/* 40 */       ActionContext.getContext().put("urladdress", "/control/index");
/* 41 */       ActionContext.getContext().getSession().put("user", this.user);
/*    */     } else {
/* 43 */       ActionContext.getContext().put("message", "用户名或密码错误");
/* 44 */       ActionContext.getContext().put("urladdress", "/admin/index");
/*    */     }
/*    */ 
/* 47 */     return "message";
/*    */   }
/*    */ 
/*    */   public String logout() {
/* 51 */     ActionContext.getContext().getSession().put("user", null);
/* 52 */     ActionContext.getContext().put("message", "退出成功");
/* 53 */     ActionContext.getContext().put("urladdress", "/");
/* 54 */     return "message";
/*    */   }
/*    */ }

/* Location:           C:\work\apache-tomcat-7.0.55\webapps\ROOT\WEB-INF\classes\
 * Qualified Name:     com.wzh.action.login.LoginAction
 * JD-Core Version:    0.6.1
 */